/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package recognize;


import detection.Detector;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import java.util.List;

/**
 *
 * @author Progresywny Maciek
 */
public class RecognizeObjectsViolaJones {

    private long detectStartTime = 0;
    private String faceCascace = "haarcascade_frontalface_default.xml";

    public RecognizeObjectsViolaJones() {
    }
    
    public RecognizeObjectsViolaJones(String faceCascace) {
        this.faceCascace=faceCascace;
    }
    
    public synchronized List<Rectangle> recognize(BufferedImage image) {
        detectStartTime = System.currentTimeMillis();
        Detector detector = Detector.create("haarcascade_frontalface_default.xml");
        List<Rectangle> res = detector.getFaces(image, 1.2f, 1.1f, .05f, 2, true);
        long detectDuration = System.currentTimeMillis() - detectStartTime;
        System.out.println("detection duration: " + detectDuration + "ms");
        return res;
    }
}
